package brickred.core
{
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;

    import away3d.core.managers.Stage3DManager;
    import away3d.core.managers.Stage3DProxy;
    import away3d.events.Stage3DEvent;

    import brickred.core.Director;
    import brickred.events.DirectorEvent;

    public class Application extends Sprite 
    {
        private var stage3d_proxy:Stage3DProxy;

        public function Application()
        {
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;

            stage3d_proxy =
                Stage3DManager.getInstance(stage).getFreeStage3DProxy();
            stage3d_proxy.addEventListener(
                Stage3DEvent.CONTEXT3D_CREATED, onContextCreated);
        }

        private function onContextCreated(event:Stage3DEvent):void
        {
            Director.createInstance(this, stage3d_proxy, onDirectorReady);
        }

        private function onDirectorReady(event:DirectorEvent):void
        {
            init();
        }

        public function init():void
        {
        }
    }
}

